﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Profile;
using System.Data;
using Gift.Model.ENUM;

namespace WebApp.admin.user
{
    public partial class userLeaveWordsEdit : BaseAdmin
    {
        // Methods
        private void Bind()
        {
            DataTable table = SQLAccess.GreatDs("select * from DB_Msg where msgid=" + re.replace(base.Request.QueryString["mid"]) + "").Tables[0];
            if (table.Rows.Count > 0)
            {
                this.title.Text = table.Rows[0]["title"].ToString();
                this.replays.Text = table.Rows[0]["replay"].ToString();
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            SQLAccess.DoSql(string.Concat(new object[] { "update DB_Msg set replay='", re.replace(base.Request.Form["replays"]), "',states=1,replaytime='", DateTime.Now, "',isnew=1,adminid=" + base.Administrator.AdminUserId + " where msgid=", re.replace(base.Request.QueryString["mid"]), "" }));
            base.Response.Write("<script language='javascript'>alert('添加处理成功！');window.location.href='userLeaveWords.aspx?mid=" + base.Request.QueryString["mid"] + "';</script>");
            base.Response.End();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            base.ValidateLoginRule(ERule.UserLeaveWords);
            if (base.Request.QueryString["mid"] != null)
            {
                this.Bind();
            }
        }
    }
}